(function(angular) {
	"use strict";
	angular.module("fs.waf").factory("rolloverService", rolloverService);
	rolloverService.$inject = [ "$q", "ajaxServiceFactory", "txnService" ];
	function rolloverService($q, ajaxServiceFactory, txnService) {
		var ajaxServices = ajaxServiceFactory.buildAjaxService({
			getProdCodeOptions : {
				url : "do/cda/dataList/prodCodeByProdSubtype",
				method : "post"
			}
		});

		function getRolloverProdCodeOptions(parms) {
			return ajaxServices.getProdCodeOptions(parms).then(function(response) {
				return $q(function(resoved, rejected) {
					resoved(response ? response.data : []);
				});
			});
		}
		
		function getLayout(packageName, packageSuffix, prodType, prodSubtype, readonly) {
			return txnService.getLayout(packageName, packageSuffix, readonly, "LOAN", prodType, prodSubtype);
		}

		return {
			getRolloverProdCodeOptions : getRolloverProdCodeOptions,
			getLayout : getLayout
		};

	}
})(angular);